<?php
namespace Admin\Controller;
class MenuController extends AdminBaseController
{
    /***
     * @privilege Admin:菜单->添加:60824141392
     */
    public function add()
    {
        if (IS_POST) {
            $data = I('post.data');
            $this->_addData('Menu', $data);
        } else {
            $menuModel = D('Menu');
            $menuList = $menuModel->treeList('&nbsp;&nbsp;',true);
            $this->assign([
                'menuList' => $menuList,
                'maxSort' => $menuModel->getMaxSort() + 1
            ]);
            $this->_display('edit', '菜单增加');
        }
    }

    /***
     * @privilege Admin:菜单->编辑:04940406796
     */
    public function edit()
    {
        if (IS_POST) {
            $data = I('post.data');
            $this->_editData('Menu', $data);
        } else {
            $info = $this->_detail('Menu');
            $menuModel = D('Menu');
            $menuList = $menuModel->treeList('&nbsp;&nbsp;',true);
            $this->assign([
                'info' => $info,
                'menuList' => $menuList

            ]);
            $this->_display('edit', '菜单编辑');
        }
    }

    /***
     * @privilege Admin:菜单->列表:99813496402
     */
    public function lis()
    {
        $where['status'] = 1;
        $result = $this->_list('Menu', $where, 10);
        $this->assign($result);
        $this->_display('lis', '菜单列表');
    }

    /***
     * @privilege Admin:菜单->删除:62094296090
     */
    public function del()
    {

        $this->_delAll('Menu');
    }

}